package com.har.modules.business.controller;

import com.har.common.utils.PageUtils;
import com.har.common.utils.R;
import com.har.modules.business.entity.TCompanyEntity;
import com.har.modules.business.service.TCompanyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 贷款产品
 *
 * @author macwy
 * @email
 * @date 2018-06-26 16:38:42
 */
@RestController
@RequestMapping("business/company")
public class CompanyController {
    @Autowired
    private TCompanyService companyService;



    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("business:company:list")
    public R list(@RequestParam Map<String, Object> params){

        PageUtils page = companyService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("business:tCompany:info")
    public R info(@PathVariable("id") Long id){
        TCompanyEntity tCompanyEntity = companyService.selectById(id);

        return R.ok().put("tCompany", tCompanyEntity);
    }


    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("business:tCompany:update")
    public R update(@RequestBody TCompanyEntity tCompanyEntity){
        companyService.updateAllColumnById(tCompanyEntity);//全部更新

        return R.ok();
    }





}
